# 创建配置类
from redis import StrictRedis
import logging


class Config(object):
    """app配置类"""
    DEBUG = True

    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/information_09'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    SECRET_KEY = 'f3masFZzcu9HqwXnw6botwWyqwts7AxANBDMUY9tq3c4TTsBtxR7O6zSzUH0wKs1'

    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(REDIS_HOST, REDIS_PORT)
    SESSION_USE_SIGNER = True  # 设置签名
    PERMANENT_SESSION_LIFETIME = 86400


class Development(Config):
    """调试模式"""
    pass

    LOGGING_LEVEL = logging.DEBUG


class Production(Config):
    """生产环境"""
    DEBUG = False

    LOGGING_LEVEL = logging.WARNING


configs = {
    'dev': Development,
    'prod': Production
}
